package kr.hkit.powerjava.chapter22.work;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class TestMain {
	public static void main(String[] args) {
		ArrayList<Student> stdList = new ArrayList<>();

		initlist(stdList);

		StudentManager sm = new StudentManager(stdList);
		sm.prnList();
		//생성
		Student std = new Student(stdList.size()+1, "손예진", 70,70,70);
		sm.addItem(std);
		sm.prnList();
		//삭제
//		sm.delStudent(std);
		sm.prnList();
/*		// 학번 이름 검색
		Student std = new Student(5, "장예원");
		// System.out.println(stdList.contains(std));
		System.out.println(stdList.indexOf(std) 뒤에서 검색lastIndexOf(std) 
				+ "의 위치에 존재" + stdList.contains(std));

		// 총점 순 정렬
		Collections.sort(stdList);
		prnHeader();
		prnList(stdList);
		// 수학점수별 정렬
		Comparator<Student> comp = new Comparator<Student>() {

			@Override
			public int compare(Student o1, Student o2) {

				return o1.getMathScore() - o2.getMathScore();
			}
		};
		Collections.sort(stdList, comp);
		prnHeader();
		prnList(stdList);*/
	}



	private static void prnList(ArrayList<Student> stdList) {
		for (Student std : stdList) {
			System.out.println(std);
		}

	}

	private static void initlist(ArrayList<Student> stdList) {
		stdList.add(new Student(1, "김태희", 87, 87, 87));
		stdList.add(new Student(2, "이민정", 70, 70, 70));
		stdList.add(new Student(3, "이나영", 95, 88, 88));
		stdList.add(new Student(4, "임수정", 87, 86, 86));
		stdList.add(new Student(5, "장예원", 87, 97, 99));
		stdList.add(new Student(6, "장예원", 80, 97, 100));

	}
}
